import Vue from 'vue';
import { Toast, Dialog, Notify } from 'vant';

Vue.use(Toast);
Vue.use(Dialog);
Vue.use(Notify);

// 请求接口使用
Vue.prototype.$loading = (isLoading) => {
  if (isLoading) {
    Vue.prototype.$toast.loading({
      mask: true,
      forbidClick: true,
      message: '数据加载中...',
      overlayStyle: {
        backgroundColor: 'rgba(0, 0, 0, 0.3)',
      },
      duration: 0,
    });
  } else {
    Vue.prototype.$toast.clear();
  }
};
